package cn.lds.j367.dsbank.controller;

import cn.lds.j367.dsbank.entity.ProvinceCityDistrict;
import cn.lds.j367.dsbank.service.ProvinceCityDistrictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/pcd")
public class ProvinceCityDistrictController {

    @Autowired
    private ProvinceCityDistrictService provinceCityDistrictService;

    @ResponseBody  //返回Json
    @RequestMapping("/show_city_or_district/{parentId}")
    public List<ProvinceCityDistrict> selectPCDByParentId(@PathVariable Integer parentId){
        List<ProvinceCityDistrict> provinceCityDistricts = provinceCityDistrictService.selectProvinceCityDistrictByParentId(parentId);
        return provinceCityDistricts;
    }
}
